home *** CD-ROM | disk | FTP | other *** search
- /* ST Color Palette by Tom Hudson
- Habba 'C' modifications by John Kurvink */
-
- /* main changes were to demote int to short and adding CONIN and
- char_input_status functions since I they replace the BCONSTAT
- and BCONIN inthe original program(with the hippo 'C' they would
- work corectly therfore program would loop forever */
-
- /* compile the program and then type ld -S st512.o color.o<ret>
- Then rename the newly created a.prg to whatever.TOS or it
- will lock up when you move the mouse */
-
- #include <aes.h>
- #include <vdi.h>
- extern go();
- extern stop();
- extern short ctable[512];
-
- short contrl[12],intin[128],ptsin[128],
- intout[128],ptsout[128];
-
- short handle,chstat;
-
- main()
- {
-
- short i,j,dum,l_intin[11],l_out[57],
- r,g,b,rx,gx,bx,cx,x,y,wchar,
- gr_1,gr_2,gr_3,gr_4,l_ptsin[20],
- oldpal[16],box[4],rgb[3],
- mousex,mousey;
- int regval;
-
- char lastr = -1, lastg = -1, lastb = -1;
-
- static short cofset[8] =
- {
- 2,3,6,4,7,5,8,9
- };
-
- static char redval[2] = {0,0};
- static char grnval[2] = {0,0};
- static char bluval[2] = {0,0};
-
- appl_init();
-
- handle=graf_handle(&gr_1,&gr_2,&gr_3,&gr_4);
-
- l_intin[0] = 1;
- for (i=1;i<10; i++)
- l_intin[i] = 1;
- l_intin[10] = 2;
- v_opnvwk(l_intin,&handle,l_out);
- v_hide_c(handle);
- v_clrwk(handle);
-
- for (i=0;i<16;i++)
- oldpal[i] = setcolor(i,-1);
-
- cx=0;
-
- for (rx=0;rx<8; rx++)
- {
- for(gx=0;gx<8;gx++)
- {
- for(bx=0;bx<8;bx++,cx++)
- {
- regval=0x0000f888 + (rx * 256) + (gx * 16) +bx;
- ctable[cx]=regval & 0xffff;
- }
- }
- }
-
- vsf_interior(handle,1);
- for (x=0,cx=0;x<319;x+=40,cx++)
- {
- vsf_color(handle,cofset[cx]);
- for (y=1;y<192;y+=3)
- {
- box[0]=x;
- box[1]=y;
- box[2]=x+38;
- box[3]=y+1;
- v_bar(handle,box);
- }
- }
-
- rgb[0]=1000; rgb[1]=1000; rgb[2]=1000;
- vs_color(handle,1,rgb);
- rgb[0]=1000;rgb[1]=0;rgb[2]=0;
- vs_color(handle,11,rgb);
- rgb[0]=0;rgb[1]=1000;rgb[2]=0;
- vs_color(handle,14,rgb);
- rgb[0]=0;rgb[1]=0;rgb[2]=1000;
- vs_color(handle,12,rgb);
-
- vst_color(handle,10);
- v_gtext(handle,40,199,"ATARI 520ST COLOR PALETTE");
- graf_mouse(0,&dum);
- v_show_c(handle,0);
-
- go();
-
- wchar=0;
- while(wchar != 32)
- {
- chstat=char_input_status(2);
- if(chstat !=0)
- wchar=conin(2);
-
- vq_mouse(handle,&dum,&mousex,&mousey);
-
- if(mousey < 192)
- {
- redval[0]=mousey / 24 + 48;
- grnval[0]=((mousey/3) & 0x0007) + 48;
- bluval[0]=mousex / 40 + 48;
- if((lastr != redval[0]) || (lastg != grnval[0]) || (lastb != bluval[0]))
- {
- v_hide_c(handle);
- vst_color(handle,11);
- v_gtext(handle,256,199,redval);
- vst_color(handle,14);
- v_gtext(handle,264,199,grnval);
- vst_color(handle,12);
- v_gtext(handle,272,199,bluval);
- v_show_c(handle,0);
- lastr=redval[0];
- lastg=grnval[0];
- lastb=bluval[0];
- }
- }
- }
-
- stop();
- setpallete(oldpal);
-
- v_clsvwk(handle);
-
- appl_exit();
-
- }
- əəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəə